{#
 This Source Code Form is subject to the terms of the Mozilla Public
 License, v. 2.0. If a copy of the MPL was not distributed with this
 file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% from "macros.html" import google_play_button with context %}
{% from "macros-protocol.html" import split with context %}

{% extends "firefox/new/basic/base.html" %}

{% set show_firefox_app_store_banner = switch('firefox-app-store-banner') %}

{% set referrals = link_referrals or '?utm_source=www.mozilla.org&utm_medium=referral&utm_campaign=firefox-desktop' %}

{# meta #}
{% set meta_title_prefix = meta_title_prefix or ftl('firefox-new-download-browser', fallback='firefox-new-download-firefox') %}
{% set meta_title = ftl('firefox-new-fast') if ftl_has_messages('firefox-new-fast') else meta_title or ftl('firefox-new-free-web-browser') %}
{% set meta_desc = meta_desc or ftl('firefox-new-desc', fallback='firefox-new-faster-page-loading-less-memory') %}
{% set og_title = og_title or ftl('firefox-new-download-browser', fallback='firefox-new-download-the-fastest-firefox') %}
{% set og_desc = og_desc or ftl('firefox-new-desc', fallback='firefox-new-faster-page-loading-less-memory') %}

{# page title #}
{%- block page_title_prefix -%}{{ meta_title_prefix }}{%- endblock -%}
{% block page_title %} — {{ meta_title }} {% endblock %}
{% block page_desc %}{{ meta_desc }}{% endblock %}
{% block page_og_title %}{{ og_title }}{% endblock %}
{% block page_og_desc %}{{ og_desc }}{% endblock %}

{# hero #}
{% set hero_title = hero_title or ftl('firefox-new-get-the-latest-firefox') %}
{% set hero_img = hero_img or 'img/firefox/new/basic/browser-window.svg' %}

{# small links #}
{% set small_advanced = small_advanced or ftl('firefox-new-advanced-install-options') %}
{% set small_lang = small_lang or ftl('firefox-new-download-in-another-language') %}
{% set small_help = small_help or ftl('firefox-new-need-help') %}

{# blocks #}

{% block extrahead %}
  {{ super() }}
  {{ css_bundle('firefox_new_download') }}
  {{ css_bundle('protocol-split') }}

  {% if show_firefox_app_store_banner %}
    {{ css_bundle('firefox-app-store-banner') }}
  {% endif %}
{% endblock %}

{% block sub_navigation %}
 {% include '/firefox/includes/desktop-platform-sub-nav.html' %}
{% endblock %}

{% block content %}
<main class="main-download" {% if v %}data-variant="{{ v }}"{% endif %}>
  {% call split(
    block_class='mzp-l-split-center-on-sm-md t-split-hero',
    media_class='mzp-l-split-media-overflow',
    media_after=True,
    image=resp_img(url=hero_img, optional_attributes={ 'class': 'mzp-c-split-media-asset' })

  ) %}
    <div class="mzp-c-wordmark mzp-t-wordmark-md mzp-t-product-firefox"></div>
    <h1 class="c-download-split-title">{{ hero_title }}</h1>
    <div class="c-intro-download">
      {% block intro_download_button %}
        {{ download_firefox_thanks(alt_copy=ftl('download-button-download-now'), locale_in_transition=True, download_location='primary cta') }}
      {% endblock %}

      {% block small_links %}
      <ul class="small-links">
        {% if ftl_has_messages('firefox-new-download-a-different') %}
        <li><a href="{{ firefox_url('desktop', 'all') }}">{{ ftl('firefox-new-download-a-different') }}</a></li>
        {% else %}
        <li><a href="{{ firefox_url('desktop', 'all') }}">{{ small_advanced }}</a></li>
        <li><a href="{{ firefox_url('desktop', 'all') }}">{{ small_lang }}</a></li>
        {% endif %}
        <li><a href="https://support.mozilla.org/products/firefox{{ referrals }}&utm_content=need-help-link">{{ small_help }}</a></li>
      </ul>
    </div>
    {% endblock %}
  {% endcall %}

  {% block features %}{% endblock %}
</main>
{% endblock %}

{% block page_banner %}
  {% if show_firefox_app_store_banner %}
    {% include 'includes/banners/mobile/firefox-app-store.html' %}
  {% endif %}
{% endblock %}

{% block js %}
  {% if show_firefox_app_store_banner %}
    {{ js_bundle('firefox-app-store-banner') }}
  {% endif %}
{% endblock %}
